package com.itheima.config;

import com.itheima.interceptor.ResourcesInterceptor;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

@Configuration
    @ComponentScan("com.itheima.controller")
    @EnableWebMvc
    public class SpringMvcConfig implements WebMvcConfigurer{
        @Override
        public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer){
            configurer.enable();
        }
        @Override
        public void configureViewResolvers(ViewResolverRegistry registry) {
            registry.jsp("/admin/", ".jsp");
        }
        @Override
    public void addInterceptors(InterceptorRegistry registry){
            registry.addInterceptor(new ResourcesInterceptor()).addPathPatterns("/**")
                    .excludePathPatterns("/css/**","/js/**","/img/**");
        }

    }

